home *** CD-ROM | disk | FTP | other *** search
/ 9-Digit Zip Code Directory / 9-Digit Zip Code Directory (American Business Information) (ABIZIP-12).ISO / z4src.zip / STDIO.H < prev    next >
C/C++ Source or Header  |  1993-11-23  |  8KB  |  353 lines

  1. /***
  2. *stdio.h - definitions/declarations for standard I/O routines
  3. *
  4. *   Copyright (c) 1985-1992, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. *   This file defines the structures, values, macros, and functions
  8. *   used by the level 2 I/O ("standard I/O") routines.
  9. *   [ANSI/System V]
  10. *
  11. ****/
  12.  
  13. #ifndef _INC_STDIO
  14.  
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif 
  18.  
  19. #if (_MSC_VER <= 600)
  20. #define __cdecl     _cdecl
  21. #define __far       _far
  22. #define __near      _near
  23. #endif 
  24.  
  25. #ifndef _SIZE_T_DEFINED
  26. typedef unsigned int size_t;
  27. #define _SIZE_T_DEFINED
  28. #endif 
  29.  
  30. #ifndef _VA_LIST_DEFINED
  31. typedef char *va_list;
  32. #define _VA_LIST_DEFINED
  33. #endif 
  34.  
  35. /* buffered I/O macros */
  36.  
  37. #define BUFSIZ  512
  38. #ifdef _MT
  39. #define _NFILE  40
  40. #else 
  41. #define _NFILE  20
  42. #endif 
  43. #define EOF (-1)
  44.  
  45. #ifndef _FILE_DEFINED
  46. #pragma pack(2)
  47. struct _iobuf {
  48.     char *_ptr;
  49.     int   _cnt;
  50.     char *_base;
  51.     char  _flag;
  52.     char  _file;
  53.     };
  54. typedef struct _iobuf FILE;
  55. #pragma pack()
  56. #define _FILE_DEFINED
  57. #endif 
  58.  
  59.  
  60. /* _P_tmpnam: Directory where temporary files may be created.
  61.  * L_tmpnam size =  size of _P_tmpdir
  62.  *  + 1 (in case _P_tmpdir does not end in "\\")
  63.  *  + 6 (for the temp number string)
  64.  *  + 1 (for the null terminator)
  65.  */
  66.  
  67. #define  _P_tmpdir "\\"
  68. #define  L_tmpnam sizeof(_P_tmpdir)+8
  69.  
  70.  
  71. /* fseek constants */
  72.  
  73. #define SEEK_CUR 1
  74. #define SEEK_END 2
  75. #define SEEK_SET 0
  76.  
  77.  
  78. /* minimum guaranteed filename length, open file count, and unique
  79.  * tmpnam filenames.
  80.  */
  81.  
  82. #define FILENAME_MAX 128
  83. #define FOPEN_MAX 18
  84. #define TMP_MAX 32767
  85. #define _SYS_OPEN 20
  86.  
  87.  
  88. /* define NULL pointer value */
  89.  
  90. #ifndef NULL
  91. #ifdef __cplusplus
  92. #define NULL    0
  93. #else 
  94. #define NULL    ((void *)0)
  95. #endif 
  96. #endif 
  97.  
  98.  
  99. /* declare _iob[] array */
  100.  
  101. #ifndef _STDIO_DEFINED
  102. extern FILE __near __cdecl _iob[];
  103. #endif 
  104.  
  105.  
  106. /* define file position type */
  107.  
  108. #ifndef _FPOS_T_DEFINED
  109. typedef long fpos_t;
  110. #define _FPOS_T_DEFINED
  111. #endif 
  112.  
  113.  
  114. /* standard file pointers */
  115.  
  116. #ifndef _WINDLL
  117. #define stdin  (&_iob[0])
  118. #define stdout (&_iob[1])
  119. #define stderr (&_iob[2])
  120. #endif 
  121. #ifndef _WINDOWS
  122. #define _stdaux (&_iob[3])
  123. #define _stdprn (&_iob[4])
  124. #endif 
  125.  
  126.  
  127. #define _IOREAD     0x01
  128. #define _IOWRT      0x02
  129.  
  130. #define _IOFBF      0x0
  131. #define _IOLBF      0x40
  132. #define _IONBF      0x04
  133.  
  134. #define _IOMYBUF    0x08
  135. #define _IOEOF      0x10
  136. #define _IOERR      0x20
  137. #define _IOSTRG     0x40
  138. #define _IORW       0x80
  139.  
  140.  
  141. #ifdef _WINDOWS
  142. #ifndef _WINDLL
  143. #ifndef _WINFO_DEFINED
  144. /* interface version number */
  145. #define _QWINVER    0
  146.  
  147. /* max number of windows */
  148. #define _WFILE      20
  149.  
  150. /* values for windows screen buffer size */
  151. #define _WINBUFINF  0
  152. #define _WINBUFDEF  -1
  153.  
  154. /* size/move settings */
  155. #define _WINSIZEMIN 1
  156. #define _WINSIZEMAX 2
  157. #define _WINSIZERESTORE 3
  158. #define _WINSIZECHAR    4
  159.  
  160. /* size/move query types */
  161. #define _WINMAXREQ  100
  162. #define _WINCURRREQ 101
  163.  
  164. /* values for closing window */
  165. #define _WINPERSIST 1
  166. #define _WINNOPERSIST   0
  167.  
  168. /* pseudo file handle for frame window */
  169. #define _WINFRAMEHAND   -1
  170.  
  171. /* menu items */
  172. #define _WINSTATBAR 1
  173. #define _WINTILE    2
  174. #define _WINCASCADE 3
  175. #define _WINARRANGE 4
  176.  
  177. /* quickwin exit options */
  178. #define _WINEXITPROMPT      1
  179. #define _WINEXITNOPERSIST   2
  180. #define _WINEXITPERSIST     3
  181.  
  182. /* open structure */
  183. #pragma pack(2)
  184. struct _wopeninfo {
  185.     unsigned int _version;
  186.     const char __far * _title;
  187.     long _wbufsize;
  188.     };
  189. #pragma pack()
  190.  
  191. /* size/move structure */
  192. struct _wsizeinfo {
  193.     unsigned int _version;
  194.     unsigned int _type;
  195.     unsigned int _x;
  196.     unsigned int _y;
  197.     unsigned int _h;
  198.     unsigned int _w;
  199.     };
  200. #define _WINFO_DEFINED
  201. #endif 
  202. #endif 
  203. #endif 
  204.  
  205. /* function prototypes */
  206.  
  207. #ifndef _STDIO_DEFINED
  208. int __cdecl _filbuf(FILE *);
  209. int __cdecl _flsbuf(int, FILE *);
  210. FILE * __cdecl _fsopen(const char *,
  211.     const char *, int);
  212. void __cdecl clearerr(FILE *);
  213. int __cdecl fclose(FILE *);
  214. int __cdecl _fcloseall(void);
  215. FILE * __cdecl _fdopen(int, const char *);
  216. int __cdecl feof(FILE *);
  217. int __cdecl ferror(FILE *);
  218. int __cdecl fflush(FILE *);
  219. int __cdecl fgetc(FILE *);
  220. #ifndef _WINDLL
  221. int __cdecl _fgetchar(void);
  222. #endif 
  223. int __cdecl fgetpos(FILE *, fpos_t *);
  224. char * __cdecl fgets(char *, int, FILE *);
  225. int __cdecl _fileno(FILE *);
  226. int __cdecl _flushall(void);
  227. FILE * __cdecl fopen(const char *,
  228.     const char *);
  229. int __cdecl fprintf(FILE *, const char *, ...);
  230. int __cdecl fputc(int, FILE *);
  231. #ifndef _WINDLL
  232. int __cdecl _fputchar(int);
  233. #endif 
  234. int __cdecl fputs(const char *, FILE *);
  235. size_t __cdecl fread(void *, size_t, size_t, FILE *);
  236. FILE * __cdecl freopen(const char *,
  237.     const char *, FILE *);
  238. #ifndef _WINDLL
  239. int __cdecl fscanf(FILE *, const char *, ...);
  240. #endif 
  241. int __cdecl fsetpos(FILE *, const fpos_t *);
  242. int __cdecl fseek(FILE *, long, int);
  243. long __cdecl ftell(FILE *);
  244. #ifdef _WINDOWS
  245. #ifndef _WINDLL
  246. FILE * __cdecl _fwopen(struct _wopeninfo *, struct _wsizeinfo *, const char *);
  247. #endif 
  248. #endif 
  249. size_t __cdecl fwrite(const void *, size_t, size_t,
  250.     FILE *);
  251. int __cdecl getc(FILE *);
  252. #ifndef _WINDLL
  253. int __cdecl getchar(void);
  254. char * __cdecl gets(char *);
  255. #endif 
  256. int __cdecl _getw(FILE *);
  257. #ifndef _WINDLL
  258. void __cdecl perror(const char *);
  259. #endif 
  260. #ifndef _WINDLL
  261. int __cdecl printf(const char *, ...);
  262. #endif 
  263. int __cdecl putc(int, FILE *);
  264. #ifndef _WINDLL
  265. int __cdecl putchar(int);
  266. int __cdecl puts(const char *);
  267. #endif 
  268. int __cdecl _putw(int, FILE *);
  269. int __cdecl remove(const char *);
  270. int __cdecl rename(const char *, const char *);
  271. void __cdecl rewind(FILE *);
  272. int __cdecl _rmtmp(void);
  273. #ifndef _WINDLL
  274. int __cdecl scanf(const char *, ...);
  275. #endif 
  276. void __cdecl setbuf(FILE *, char *);
  277. int __cdecl setvbuf(FILE *, char *, int, size_t);
  278. int __cdecl _snprintf(char *, size_t, const char *, ...);
  279. int __cdecl sprintf(char *, const char *, ...);
  280. #ifndef _WINDLL
  281. int __cdecl sscanf(const char *, const char *, ...);
  282. #endif 
  283. char * __cdecl _tempnam(char *, char *);
  284. FILE * __cdecl tmpfile(void);
  285. char * __cdecl tmpnam(char *);
  286. int __cdecl ungetc(int, FILE *);
  287. int __cdecl _unlink(const char *);
  288. int __cdecl vfprintf(FILE *, const char *, va_list);
  289. #ifndef _WINDLL
  290. int __cdecl vprintf(const char *, va_list);
  291. #endif 
  292. int __cdecl _vsnprintf(char *, size_t, const char *, va_list);
  293. int __cdecl vsprintf(char *, const char *, va_list);
  294. #define _STDIO_DEFINED
  295. #endif 
  296.  
  297. /* macro definitions */
  298.  
  299. #define feof(_stream)     ((_stream)->_flag & _IOEOF)
  300. #define ferror(_stream)   ((_stream)->_flag & _IOERR)
  301. #define _fileno(_stream)  ((int)(unsigned char)(_stream)->_file)
  302. #define getc(_stream)     (--(_stream)->_cnt >= 0 ? 0xff & *(_stream)->_ptr++ \
  303.     : _filbuf(_stream))
  304. #define putc(_c,_stream)  (--(_stream)->_cnt >= 0 \
  305.     ? 0xff & (*(_stream)->_ptr++ = (char)(_c)) :  _flsbuf((_c),(_stream)))
  306. #ifndef _WINDLL
  307. #define getchar()     getc(stdin)
  308. #define putchar(_c)   putc((_c),stdout)
  309. #endif 
  310.  
  311. #ifdef _MT
  312. #undef  getc
  313. #undef  putc
  314. #undef  getchar
  315. #undef  putchar
  316. #endif 
  317.  
  318. #ifndef __STDC__
  319. /* Non-ANSI names for compatibility */
  320.  
  321. #define P_tmpdir  _P_tmpdir
  322. #define SYS_OPEN  _SYS_OPEN
  323.  
  324. #ifndef _WINDOWS
  325. #define stdaux    _stdaux
  326. #define stdprn    _stdprn
  327. #endif 
  328.  
  329. int __cdecl fcloseall(void);
  330. FILE * __cdecl fdopen(int, const char *);
  331. #ifndef _WINDLL
  332. int __cdecl fgetchar(void);
  333. #endif 
  334. int __cdecl fileno(FILE *);
  335. int __cdecl flushall(void);
  336. #ifndef _WINDLL
  337. int __cdecl fputchar(int);
  338. #endif 
  339. int __cdecl getw(FILE *);
  340. int __cdecl putw(int, FILE *);
  341. int __cdecl rmtmp(void);
  342. char * __cdecl tempnam(char *, char *);
  343. int __cdecl unlink(const char *);
  344.  
  345. #endif 
  346.  
  347. #ifdef __cplusplus
  348. }
  349. #endif 
  350.  
  351. #define _INC_STDIO
  352. #endif 
  353.